package com.outsource.framework.model.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import com.outsource.framework.domain.Thaoduan;

public interface ThaoduanRepository extends CrudRepository<Thaoduan, Integer>, JpaSpecificationExecutor<Thaoduan>{

	@Query(value="select * from t_haoduan where id = :id",nativeQuery = true)
	Thaoduan getById(@Param("id")Integer id);
	@Query(value="select * from t_haoduan where haoduan_start <= :mobile and haoduan_end >= :mobile",nativeQuery = true)
	Thaoduan findByAttribution(@Param("mobile")String mobile);
	@Query(value="select name from t_location where code = :code",nativeQuery=true)
	String findLocation(@Param("code")String code);
}
